<div id="draw-setting" class="setting">
	<h4>友情提醒：请填写已通过实名认证的支付宝账号，否则无法正常收款。</h4>
	<form id="save-draw-setting" action="/user/saveDrawSetting" method="post" accept-charset="utf-8">
		${token!}
		<div class="field">
			<label>我的真实姓名：</label>
			<#if onlineUser.realname??>
			<input type="text" value="${onlineUser.realname}" name="realname" disabled="disabled"/>
			<#else>
			<input type="text" value="" name="realname" data-length="60"/>
			</#if>
			<span>请填写您的真实姓名</span>
		</div>
		<div class="field">
			<label>收款支付宝账户：</label> 
			<#if onlineUser.alipay??>
			<input type="text" value="${onlineUser.alipay}" name="alipay" disabled="disabled"/>
			<#else>
			<input type="text" value="" name="alipay" data-length="60"/>
			</#if>
			<span>无需密码，请放心填写；<a target="_blank" href="http://member1.taobao.com/member/manage_account.htm?asker=wangwang"
				hidefocus="true">忘记账户？点此查看&gt;</a></span>
		</div>
		<div class="field">
			<label>我的QQ号码：</label>
			<#if onlineUser.qq??>
			<input type="text" value="${onlineUser.qq}" name="qq" disabled="disabled"/>
			<#else>
			<input type="text" value="" name="qq" data-length="60"/>
			</#if>
			<span>以后每次提现均要通过QQ确认后再打款，以确保资金安全</span>
		</div>
		<#if onlineUser.alipay??>
		<#else>
		<div class="submit">
			<a class="btn" hidefocus="true">保存设置</a>
		</div>
		</#if>
	</form>
</div>
<script type="text/javascript">
if($("#draw-setting .btn")[0]){
	$("#draw-setting .btn").click(function(){
		var options = {
			dataType:"json",
			beforeSubmit:function(formData,jqForm,options){
				var formElement = $(jqForm[0]),
				realname = formElement.find("input[name='realname']"),
				alipay = formElement.find("input[name='alipay']"),
				qq = formElement.find("input[name='qq']");
					
				if($.koorz.util.isEmpty(realname.val())){
		  			alert("请填写您的真实姓名,不能为空");
		            return false;
		  		}else if(!$.koorz.util.isEmpty(realname.val()) && realname.val().length <= realname.attr("data-length")){
		  			alert("长度不能超过60个字符");
		            return false;
		  		}
				if($.koorz.util.isEmpty(alipay.val())){
		  			alert("请填写您的收款支付宝账户,不能为空");
		            return false;
		  		}else if(!$.koorz.util.isEmpty(alipay.val()) && alipay.val().length <= alipay.attr("data-length")){
		  			alert("长度不能超过60个字符");
		            return false;
		  		}
				if($.koorz.util.isEmpty(qq.val())){
		  			alert("请填写您的QQ号码,不能为空");
		            return false;
		  		}else if(!$.koorz.util.isEmpty(qq.val()) && qq.val().length <= qq.attr("data-length")){
		  			alert("长度不能超过60个字符");
		            return false;
		  		}
		  		return true;
			},
		   	success:function(resp, status){
		   		if(status == 'success'){
		   			alert(resp.msg);
		   			$(".assets-navi .tab")[3].click();
				}
		   	}
		};
		$("#save-draw-setting").ajaxSubmit(options);
		return false;
	});	
}
</script>